package com.shanyu.wechat.util;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.experimental.UtilityClass;

import java.util.Map;

import static org.apache.commons.collections4.MapUtils.getInteger;

@UtilityClass
public class ParameterUtils {

    public <T> Page<T> getPage(Map<String, Object> params) {
        Integer pageNum = getInteger(params, "current", 1);
        Integer pageSize = getInteger(params, "pageSize", 10);
        return new Page<>(pageNum, pageSize);
    }

    public <T> Page<T> getPage(int current,int pageSize) {
        return new Page<>(current, pageSize);
    }
}
